Skip to content

lib/types: allow changing the name of name#218812

Closed
ncfavier wants to merge 1 commit intoNixOS:masterfrom
ncfavier:name-name
Closed

lib/types: allow changing the name of name#218812
ncfavier wants to merge 1 commit intoNixOS:masterfrom
ncfavier:name-name

Conversation

@ncfavier
Copy link
Member

@ncfavier ncfavier commented Feb 28, 2023

Provides a way to fïx nix-community/home-manager#3716

Adds a new nameArgument argument to submoduleWith that allows changing which argument the "name" (last item of loc, i.e. attribute name or option name this submodule appears under) is bound to.

This avoids conflicts when moduleType is used inside a submodule, where name would be set to both the outer submodule's name and the inner one's. If the outer submodule type sets nameArgument to something different, moduleType will continue using name, avoiding the conflict.

Ideally, there should probably be a way to change the inner name too to remove all ambiguity.

Adds a new `nameArgument` argument to `submoduleWith` that allows
changing which argument the "name" (last item of `loc`, i.e. attribute
name or option name this submodule appears under) is bound to.

This avoids conflicts when `moduleType` is used inside a submodule,
where `name` would be set to both the outer submodule's name and the
inner one's. If the outer submodule type sets `nameArgument` to
something different, `moduleType` will continue using `name`, avoiding
the conflict.

Ideally, there should probably be a way to change the inner `name` too
to remove all ambiguity.
@roberth
Copy link
Member

roberth commented Feb 28, 2023

Duplicate of #177576, but can be considered again.
Please don't remove the PR template.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Feb 28, 2023
@ncfavier
Copy link
Member Author

ncfavier commented Feb 28, 2023

I thought this might have been a known issue, but couldn't find it. I certainly did not expect it to have been known for 9 years 😅.

Since much better solutions are being discussed (dependentAttrsOf, attrsWith) and the issue seems to have a workaround anyway, I think I'll close this.

@ncfavier ncfavier closed this Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants